﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TicketInfo.aspx.cs" Inherits="NJL.WebManage.Attractions.TicketInfo" %>

<%@ Import Namespace="Royalsoft.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        function textboxSelect() {
            var checkbox = document.getElementsByName("cbxSingle");
            for (var i = 0; i < checkbox.length; i++) {
                checkbox[i].checked = !checkbox[i].checked;
            }
        }
        function checkCheckboxState() {
            var checkbox = document.getElementsByName("cbxSingle");
            var hiddenId = "";
            var count = 0;
            for (var i = 0; i < checkbox.length; i++) {
                if (checkbox[i].checked == true) {
                    hiddenId += checkbox[i].value + ",";
                    count++;
                }
            }
            if (count == 0) {
                alert('请选择您要删除的记录')
                return false;
            }
            else {
                if (window.confirm("您确定要删除该记录？")) {
                    hiddenId = hiddenId.substring(0, hiddenId.length - 1);
                    document.getElementById("<%=HSelectId.ClientID %>").value = hiddenId;
                }
                else {
                    return false;
                }
            }
        }
        function tickvalue(id) {
            var iframesrc = document.getElementById("tick").src = "TicketInfo.aspx?id=" + id;
        }
        //去掉左右空格
        String.prototype.trim = function () {
            return this.replace(/(^\s*)|(\s*$)/g, "");
        }
        function isTime(str) {
            var a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
            if (a == null) { alert('输入的参数不是时间格式'); return false; }
            if (a[1] > 24 || a[3] > 60 || a[4] > 60) {
                alert("时间格式不对");
                return false
            }
            return true;
        }

        function check() {

            var regInt = /^\d+/; //整数
            var txtSort = document.getElementById("<%=txtSort.ClientID %>").value;
            if (regInt.exec(txtSort) == null) {
                alert("排序只能输入整数");
                return false;
            }
            var txtName = document.getElementById("<%=txtName.ClientID %>").value;
            if (txtName.trim() == "") {
                alert("请输入名称");
                document.getElementById("<%=txtName.ClientID %>").focus();
                return false;
            }
            var txtMarketPrice = document.getElementById("<%=txtMarketPrice.ClientID %>").value;
            if (txtMarketPrice.trim() == "") {
                alert("请输入市场价格");
                document.getElementById("<%=txtMarketPrice.ClientID %>").focus();
                return false;
            }
            var regDecimal = /^\d+(\.\d+)?$/;
            if (regDecimal.exec(txtMarketPrice) == null) {
                alert("市场价格内容只能为数字和小数点");
                return false;
            }
            var txtLocalPrice = document.getElementById("<%=txtLocalPrice.ClientID %>").value;
            if (txtLocalPrice.trim() == "") {
                alert("请输入本站价格");
                document.getElementById("<%=txtLocalPrice.ClientID %>").focus();
                return false;
            }
            if (regDecimal.exec(txtLocalPrice) == null) {
                alert("本站价格内容只能为数字和小数点");
                return false;
            }
            var txtAgentPrice = document.getElementById("<%=txtAgentPrice.ClientID %>").value;
            if (txtAgentPrice.trim() == "") {
                alert("请输入代理价格");
                document.getElementById("<%=txtAgentPrice.ClientID %>").focus();
                return false;
            }
            if (regDecimal.exec(txtAgentPrice) == null) {
                alert("代理价格内容只能为数字和小数点");
                return false;
            }
            var txtGroupPrice = document.getElementById("<%=txtGroupPrice.ClientID %>").value;
            if (txtGroupPrice.trim() == "") {
                alert("请输入团购价格");
                document.getElementById("<%=txtGroupPrice.ClientID %>").focus();
                return false;
            }
            if (regDecimal.exec(txtGroupPrice) == null) {
                alert("团购价格内容只能为数字和小数点");
                return false;
            }
            var txtBackPrice = document.getElementById("<%=txtBackPrice.ClientID %>").value;
            if (txtBackPrice.trim() == "") {
                alert("请输入返点金额");
                document.getElementById("<%=txtBackPrice.ClientID %>").focus();
                return false;
            }
            if (regDecimal.exec(txtBackPrice) == null) {
                alert("返点金额内容只能为数字和小数点");
                return false;
            }
            var regInteger = /\d+/;
            var txtkssl = document.getElementById("<%=txtkssl.ClientID %>").value;
            if (txtkssl.trim() != "" && regInteger.exec(txtkssl) == null) {
                alert("可售数量只能为数字");
                document.getElementById("<%=txtkssl.ClientID %>").focus();
                return false;
            }
            var txtyssl = document.getElementById("<%=txtyssl.ClientID %>").value;
            if (txtyssl.trim() != "" && regInteger.exec(txtyssl) == null) {
                alert("可售数量只能为数字");
                document.getElementById("<%=txtyssl.ClientID %>").focus();
                return false;
            }
            var txtydjzsj = document.getElementById("<%=txtydjzsj.ClientID %>").value;
            var a = txtydjzsj.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
            if (a == null) { alert('输入当天预订截止时间的参数不是时间格式'); return false; }
            if (a[1] > 24 || a[3] > 60 || a[4] > 60) {
                alert("当天预订截止时间格式不正确");
                return false
            }
            return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="main_content fr">
        <div class="gray_bd">
            <div class="table_title">
                订票信息
            </div>
            <div class="pad5px">
                <table cellpadding="0" cellspacing="0" style="width: 100%" align="center">
                    <tr>
                        <td style="width: 120px; text-align: right;">
                            排序：
                        </td>
                        <td>
                            <asp:TextBox ID="txtSort" runat="server" MaxLength="8" Width="50px">0</asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            预订名称 ：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtName" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            预订说明 ：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtBookIntro" runat="server" Width="50%"></asp:TextBox>对预定简单说明，最好在20字以内。最大100个字。
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            预订类型 ：
                        </td>
                        <td align="left">
                            <asp:RadioButtonList ID="rblType" runat="server" Height="26px" RepeatDirection="Horizontal">
                            </asp:RadioButtonList>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            票务预订付款方式 ：
                        </td>
                        <td align="left">
                            <asp:RadioButtonList ID="rblfkfs" runat="server" RepeatDirection="Horizontal">
                            </asp:RadioButtonList>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            市场价格 ：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtMarketPrice" runat="server" MaxLength="9" Width="50px" Style="text-align: right">0</asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            本站价格 ：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtLocalPrice" runat="server" MaxLength="9" Width="50px" Style="text-align: right">0</asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            代理价格 ：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtAgentPrice" runat="server" MaxLength="9" Width="50px" Style="text-align: right">0</asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            团购价格 ：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtGroupPrice" runat="server" MaxLength="9" Width="50px" Style="text-align: right">0</asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            返点金额 ：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtBackPrice" runat="server" MaxLength="9" Width="50px" Style="text-align: right">0</asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            组团最少人数：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtGroupMinCount" runat="server" MaxLength="8" Width="50px" Style="text-align: right" Text="1000"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            可售数量：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtkssl" runat="server" MaxLength="8" Width="50px"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            已售数量：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtyssl" runat="server" MaxLength="8" Width="50px"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            有效开始日期：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtyxksrq" runat="server" Width="133px" onClick="WdatePicker()"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            有效结束日期：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtyxjsrq" runat="server" Width="131px" onClick="WdatePicker()"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            当天预订截止时间：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtydjzsj" runat="server" Width="131px"></asp:TextBox>形如 (13:04:06)
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            取票地点：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtPickBookAddress" runat="server" Width="200px"></asp:TextBox>(用于短信,最好在10个汉字以内)例如：景点售票处
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            购票须知：
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtgpxz" runat="server" Height="59px" TextMode="MultiLine" Width="338px"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click" OnClientClick="return check()" />
                            &nbsp;<input id="Reset1" type="reset" value="重置" runat="server" />
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
                <hr />
                <div class="border_b_dotted">
                    <table class="tableliststyle" cellspacing="0" rules="all" border="1">
                        <tr class="gridheader">
                            <th style="width: 40px;">
                                <input id="cbxAll" type="checkbox" onclick="textboxSelect()" />
                            </th>
                            <th>
                                序号
                            </th>
                            <th>
                                预订名称
                            </th>
                            <th>
                                市场价格
                            </th>
                            <th style="width: 120px;">
                                本站价格
                            </th>
                            <th style="width: 80px;">
                                返点金额
                            </th>
                            <th style="width: 80px;">
                                排序
                            </th>
                            <th style="width: 40px;">
                                编辑
                            </th>
                            <th style="width: 40px;">
                                删除
                            </th>
                        </tr>
                        <asp:Repeater ID="rptUserList" runat="server" OnItemCommand="rptUserList_ItemCommand"
                            OnItemDataBound="rptUserList_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td align="center">
                                        <input id="<%#Eval("ID") %>" type="checkbox" value="<%#Eval("ID") %>" name="cbxSingle" />
                                    </td>
                                    <td align="center">
                                        <asp:Literal ID="litNum" runat="server"></asp:Literal>
                                    </td>
                                    <td align="center">
                                        <%#Eval("BOOK_NAME")%>
                                    </td>
                                    <td align="center">
                                        <%#Eval("MARKET_PRICE","{0:0.00}")%>
                                    </td>
                                    <td align="center">
                                        <%#Eval("LOCAL_PRICE","{0:0.00}")%>
                                    </td>
                                    <td align="center">
                                        <%#Eval("BACK_PRICE","{0:0.00}")%>
                                    </td>
                                    <td align="center">
                                        <%#Eval("SORT")%>
                                    </td>
                                    <td align="center">
                                        <asp:LinkButton ID="lbntEdit" runat="server" CommandName="Edit" CommandArgument='<%#Eval("ID") %>'>编辑</asp:LinkButton>
                                    </td>
                                    <td align="center">
                                        <asp:LinkButton ID="lbtnDel" runat="server" CommandName="Del" CommandArgument='<%#Eval("ID") %>'
                                            OnClientClick="return confirm('您确定要删除该信息吗？')">删除</asp:LinkButton>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                    <div style="text-align: left; margin-top: 5px;">
                        <asp:Button ID="btnDel" runat="server" Text="删除" OnClientClick="return checkCheckboxState()"
                            OnClick="btnDel_Click1" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <asp:HiddenField ID="HSelectId" runat="server" />
    </form>
</body>
</html>
